package util;

import java.util.List;

import ui.PinyinComparator;

public class StringListSorter {
	public void sort(List<String> list, PinyinComparator cmp) {
		int i, j;
		for (i = 1; i < list.size(); i++) {
			if (cmp.compare(list.get(i - 1), list.get(i)) > 0) {
				String tmp = new String(list.get(i));
				for (j = i; j > 0 && cmp.compare(list.get(j-1), tmp) > 0; j--)
					list.set(j, list.get(j-1));
				list.set(j, tmp);
			}
		}
	}
}
